package HLLibClasses;

import HLCode.HLClassManager;
import HLCode.HLLibClass;
import HLCode.HLObject;
import HLLib.base.HLRandom;

public class HLClassRandom extends HLLibClass {
    public HLClassRandom(HLClassManager owner) {
        super(owner);
    }

    public HLObject NewObject() {
        return new HLRandom();
    }

    public void Execute(HLObject self, int index, HLObject args, HLObject resultOwnerObject, int resultIndex) {
        switch (index) {
        case 0: {
            ((HLRandom) self).SetSeed(args.GetInt(0));
            break;
        }
        case 1: {
            if (resultOwnerObject == null) {
                ((HLRandom) self).Next();
            } else {
                resultOwnerObject.SetInt(resultIndex, ((HLRandom) self).Next());
            }
            break;
        }
        case 2: {
            if (resultOwnerObject == null) {
                ((HLRandom) self).NextEnd(args.GetInt(0));
            } else {
                resultOwnerObject.SetInt(resultIndex, ((HLRandom) self).NextEnd(args.GetInt(0)));
            }
            break;
        }
        case 3: {
            if (resultOwnerObject == null) {
                ((HLRandom) self).NextMax(args.GetInt(0));
            } else {
                resultOwnerObject.SetInt(resultIndex, ((HLRandom) self).NextMax(args.GetInt(0)));
            }
            break;
        }
        case 4: {
            if (resultOwnerObject == null) {
                ((HLRandom) self).NextMinMax(args.GetInt(0), args.GetInt(1));
            } else {
                resultOwnerObject.SetInt(resultIndex, ((HLRandom) self).NextMinMax(args.GetInt(0), args.GetInt(1)));
            }
            break;
        }
        case 5: {
            if (resultOwnerObject == null) {
                ((HLRandom) self).NextStartEnd(args.GetInt(0), args.GetInt(1));
            } else {
                resultOwnerObject.SetInt(resultIndex, ((HLRandom) self).NextStartEnd(args.GetInt(0), args.GetInt(1)));
            }
            break;
        }
        }
    }
}
